negotiator
Class Agent

java.lang.Object
  extended by negotiator.Agent

public abstract class Agent
extends java.lang.Object

A basic negotiation agent. You might want to consider using the BOA framework.

Author:
Dmytro Tykhonov, W.Pasman

Field Summary
 negotiator.protocol.BilateralAtomicNegotiationSession fNegotiation
          Reference to protocol which is set when experimental setup is enabled.
 java.lang.Integer sessionNumber
          To be implemented correctly.
 java.lang.Integer sessionTotalNumber
          To be implemented correctly.
 java.util.Date startTime
          Deprecated. 
 Timeline timeline
          Use timeline for everything time-related.
 java.lang.Integer totalTime
          Deprecated. 
 UtilitySpace utilitySpace
          Preference profile of the agent as assigned by the tournamentrunner.
 
Constructor Summary
Agent()
          Empty constructor used to initialize the agent.
 
Method Summary
abstract  Action chooseAction()
          this function is called after ReceiveMessage, with an Offer-action.
 void cleanUp()
          This function cleans up the remainders of the agent: open windows etc.
 AgentID getAgentID()
           
 java.lang.String getName()
           
 java.util.HashMap<negotiator.tournament.VariablesAndValues.AgentParameterVariable,negotiator.tournament.VariablesAndValues.AgentParamValue> getParameterValues()
          Deprecated. 
 StrategyParameters getStrategyParameters()
           
 double getUtility(Bid bid)
          A convenience method to get the discounted utility of a bid.
static java.lang.String getVersion()
           
 void init()
          This method is called by the protocol every time before starting a new session after the internalInit method is called.
 void internalInit(int sessionNumber, int sessionTotalNumber, java.util.Date startTimeP, java.lang.Integer totalTimeP, Timeline timeline, UtilitySpace us, java.util.HashMap<negotiator.tournament.VariablesAndValues.AgentParameterVariable,negotiator.tournament.VariablesAndValues.AgentParamValue> params)
          This method is called by the protocol to initialize the agent with a new session information.
 boolean isUIAgent()
          Determine if this agent is communicating with the user about nego steps.
 void parseStrategyParameters(java.lang.String variables)
          Used to parse parameters presented in the agent repository.
 void ReceiveMessage(Action opponentAction)
          informs you which action the opponent did
 void setAgentID(AgentID value)
           
 void setName(java.lang.String pName)
          Sets the name of the agent to the given name.
 void sleep(double fraction)
          Let the agent wait.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

utilitySpace

public UtilitySpace utilitySpace
Preference profile of the agent as assigned by the tournamentrunner.


startTime

@Deprecated
public java.util.Date startTime
Deprecated. 
Date object specifying when the negotiation started. Use timeline instead.


totalTime

@Deprecated
public java.lang.Integer totalTime
Deprecated. 
Total time which an agent has to complete the negotiation. Use timeline instead.


timeline

public Timeline timeline
Use timeline for everything time-related.


sessionNumber

public java.lang.Integer sessionNumber
To be implemented correctly.


sessionTotalNumber

public java.lang.Integer sessionTotalNumber
To be implemented correctly.


fNegotiation

public negotiator.protocol.BilateralAtomicNegotiationSession fNegotiation
Reference to protocol which is set when experimental setup is enabled.

Constructor Detail

Agent

public Agent()
Empty constructor used to initialize the agent. Later on internalInit is called to set all variables.

Method Detail

getVersion

public static java.lang.String getVersion()
Returns:
version of the agent.

init

public void init()
This method is called by the protocol every time before starting a new session after the internalInit method is called. User can override this method.


internalInit

public final void internalInit(int sessionNumber,
                               int sessionTotalNumber,
                               java.util.Date startTimeP,
                               java.lang.Integer totalTimeP,
                               Timeline timeline,
                               UtilitySpace us,
                               java.util.HashMap<negotiator.tournament.VariablesAndValues.AgentParameterVariable,negotiator.tournament.VariablesAndValues.AgentParamValue> params)
This method is called by the protocol to initialize the agent with a new session information.

Parameters:
sessionNumber - number of the session.
sessionTotalNumber - total number of sessions.
startTimeP -
totalTimeP -
timeline - keeping track of the time in the negotiation.
us - utility space of the agent for the session.
params - parameters of the agent.

ReceiveMessage

public void ReceiveMessage(Action opponentAction)
informs you which action the opponent did

Parameters:
opponentAction -

chooseAction

public abstract Action chooseAction()
this function is called after ReceiveMessage, with an Offer-action.

Returns:
(should return) the bid-action the agent wants to make.

getName

public java.lang.String getName()
Returns:
name of the agent.

getParameterValues

@Deprecated
public java.util.HashMap<negotiator.tournament.VariablesAndValues.AgentParameterVariable,negotiator.tournament.VariablesAndValues.AgentParamValue> getParameterValues()
Deprecated. 

Returns:
a type of parameters used solely by the BayesianAgent.

setName

public final void setName(java.lang.String pName)
Sets the name of the agent to the given name.

Parameters:
pName - to which the agent's name must be set.

getUtility

public double getUtility(Bid bid)
A convenience method to get the discounted utility of a bid. This method will take discount factors into account (if any), using the status of the current timeline.

Parameters:
bid - of which we are interested in the utility.
Returns:
discounted utility of the given bid.
See Also:
UtilitySpace

sleep

public void sleep(double fraction)
Let the agent wait. Example:
sleep(0.1) will let the agent sleep for 10% of the negotiation time (as defined by the Timeline).

Parameters:
fraction - should be between 0 and 1.

isUIAgent

public boolean isUIAgent()
Determine if this agent is communicating with the user about nego steps.

Returns:
true if a human user is directly communicating with the agent in order to steer the nego. This flag is used to determine the timeout for the negotiation (larger with human users).

cleanUp

public void cleanUp()
This function cleans up the remainders of the agent: open windows etc. This function will be called when the agent is killed, typically when it was timed out in a nego session. The agent will not be able to do any negotiation actions here, just clean up. To ensure that the agent can not sabotage the negotiation, this function will be called from a separate thread.


getAgentID

public AgentID getAgentID()
Returns:
ID of the agent as assigned by the protocol.

setAgentID

public void setAgentID(AgentID value)
Parameters:
value - to which the agent's ID must be set.

getStrategyParameters

public StrategyParameters getStrategyParameters()
Returns:
strategy parameters

parseStrategyParameters

public void parseStrategyParameters(java.lang.String variables)
                             throws java.lang.Exception
Used to parse parameters presented in the agent repository. The particular implementation below parses parameters such as time=0.9;e=1.0.

Parameters:
variables -
Throws:
java.lang.Exception